import request from '@/config/axios'

/** 部门协同-项目列信息 */
export interface ProjectList {
  id: number; // ID
  templateId: number; // 项目模板
  projectId: number;
  projectName?: string; // 项目名称
  projectImg: string; // 模板图片
  projectFile: string; // 项目文件
  projectCollect: string; // 项目收藏
  projectUsers: string; // 项目成员
  state: string; // 状态
  remark: string; // 备注
}

// 部门协同-项目列 API
export const ProjectListApi = {
  // 查询部门协同-项目列分页
  getProjectListPage: async (params: any) => {
    return await request.get({url: `/synergy/project-list/page`, params})
  },

  // 查询部门协同-项目列详情
  getProjectList: async (id: number) => {
    return await request.get({url: `/synergy/project-list/get?id=` + id})
  },

  // 新增部门协同-项目列
  createProjectList: async (data: ProjectList) => {
    return await request.post({url: `/synergy/project-list/create`, data})
  },

  // 修改部门协同-项目列
  updateProjectList: async (data: ProjectList) => {
    return await request.put({url: `/synergy/project-list/update`, data})
  },

  // 删除部门协同-项目列
  deleteProjectList: async (id: number) => {
    return await request.delete({url: `/synergy/project-list/delete?id=` + id})
  },

  /** 批量删除部门协同-项目列 */
  deleteProjectListList: async (ids: number[]) => {
    return await request.delete({url: `/synergy/project-list/delete-list?ids=${ids.join(',')}`})
  },

  // 导出部门协同-项目列 Excel
  exportProjectList: async (params) => {
    return await request.download({url: `/synergy/project-list/export-excel`, params})
  },

  // 收藏部门协同-项目列
  collectProject: async (data:any) => {
    return await request.post({url: `/synergy/project-list/collectProject`, data})
  },
}
